package com.qf.controller;

import com.qf.entity.SysUser;
import com.qf.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class JwtLoginController {

    @Autowired
    private AuthenticationManager authenticationManager;
    @Autowired
    private com.qf.utils.JwtUtils jwtUtils;

    @Autowired
    private SysUserService sysUserService;


    @PostMapping("/user/login")
    public String login(@RequestBody SysUser sysUser) {
        System.out.println("login:" + sysUser.getUsername() + " " + sysUser.getPassword());
        String jwtToken = sysUserService.login(sysUser.getUsername(), sysUser.getPassword());
        System.out.println("jwtToken:" + jwtToken);
        return jwtToken;

    }

}
